package io.tim.mvc_f2.bean;

import java.util.Map;

import io.tim.mvc_f2.util.CastUtil;

public class Param {
	
	private Map<String, Object> paramMap;
	
	public Param(Map<String, Object> paramMap) {
		this.paramMap = paramMap;
	}
	
	/**
	 * 根据参数名获取 String 型参数值
	 */
	public String getString(String paramName) {
		return CastUtil.castString(paramMap.get(paramName));
	}
	
	/**
	 * 根据参数名获取 double 型参数值
	 */
	public double getDouble(String paramName) {
		return CastUtil.castDouble(paramMap.get(paramName));
	}
	
	/**
	 * 根据参数名获取 long 型参数值
	 */
	public long getLong(String paramName) {
		return CastUtil.castLong(paramMap.get(paramName));
	}
	
	/**
	 * 根据参数名获取 int 型参数值
	 */
	public int getInt(String paramName) {
		return CastUtil.castInt(paramMap.get(paramName));
	}
	
	/**
	 * 根据参数名获取 boolean 型参数值
	 */
	public boolean getBoolean(String paramName) {
		return CastUtil.castBoolean(paramMap.get(paramName));
	}

	/**
	 * 获取所有字段信息
	 * @return
	 */
	public Map<String, Object> getParamMap() {
		return paramMap;
	}
	
	
}
